<?php include THEMES_PATH . 'public/before_body2.phtml';?>
<link href="/statics/front/css/cart-mobile.css" rel="stylesheet">
</head>
<body>
<?php include THEMES_PATH . 'public/header2.phtml';?>
<div class="main-width mt2x">
  <div class="align-center title"><?php echo L('shoppingcart');?></div>
  <?php
    if (isset($cartInfo) && isset($cartInfo['productList']) && $cartInfo['productList']) :
  ?>
  <div class="clearfix shopping-list-head">
    <a href="<?php echo url('product/all'); ?>" class="btn-square-o"><?php echo L('_continue_shopping_')?></a>
    <?php if( (isset($measureList) && $measureList) || ($custom_count == 0) ){?>
    <!--CHECKOUT-->
    <a href="<?php echo isset($login_url) ? $login_url.'/set/measure' : 'javascript:;';?>" class="btn-square-o add-measurement<?php echo isset($login_url) ? '' : ' js-add-measurement';?>">添加量体数据</a>
    <?php } ?>
    <?php if( (!UserModel::logged()) && !$measureList && ($custom_count > 0) ){ ?>
    <p>
      <a href="<?php echo url('user/login', array('src' =>base64_encode(url('cart/info')))); ?>" class="text" style="color:#3eabb8;"><?php echo L('_MEASUREMENT_login_url_')?></a> <?php echo L('_MEASUREMENT_login_'); ?>
    </p>
    <?php } ?>
  </div>
  <table class="shopping-list js-shopping-list">
    <?php
      $i=0;
      foreach ($cartInfo['productList'] as $k => $cart) :
        $product = $cart['product'];
        $i++;
    ?>
    <?php if($cart['is_display']==1):?>
    <!-- sold out, start -->
    <tr id="<?php echo $i;?>" data-goods-id="<?php echo $cart['product']['id'];?>" data-cart-id="<?php echo $cart['id'];?>"<?php if($cart['is_display']==1):?> class="sold-out"<?php endif;?>>
      <td width="7%">
        <input type="hidden" name="cart_item_id_checked[]" value="<?php echo $cart['id']; ?>">
        <input type="hidden" name="pids[]" value="<?php echo isset($cart['pid']) ? $cart['pid'] : null ?>">
        <input type="hidden" name="cart_item_ids[]" value="<?php echo $cart['id']; ?>">
        <img src="<?php echo $product['small_img']; ?>" alt="<?php echo isset($product['name']) ? $product['name'] : null; ?>" class="db">
      </td>
      <td width="63%" class="pl1x pr1x">
        <?php echo isset($product['name']) ? $product['name'] : null; ?>
        <p class="mt1x"><?php echo L('SOLD_OUT')?></p>
      </td>
      <?php
        $advanced_price = $product['advanced_price'];
        $original_price = $product['original_price'];
      ?>
      <td width="30%" class="align-right last">
        <p class="mb1x js-subtotal"><?php echo currency($product['price']*$cart['qty']); ?></p>
        <span title="<?php echo L('delete');?>" data-cart-id="<?php echo $cart['id'];?>" data-btn1="<?php echo L('determine'); ?>" data-btn2="<?php echo L('cancel'); ?>" data-msg="<?php echo L('del_goods_confirm'); ?>" class="delete js-delete">×</span>
      </td>
    </tr>
    <!-- sold out, end -->
    <?php  else: ?>
    <tr id="<?php echo $i; ?>" data-goods-id="<?php echo $cart['product']['id'];?>" data-cart-id="<?php echo $cart['id']; ?>" data-model-id="<?php echo $cart['product']['model_id']; ?>" data-unit-price="<?php echo isset($product['price']) ? $product['price'] : null; ?>"<?php if($cart['add_pants']):?> class="add_pants_parent_tr"<?php endif;?>>
      <td width="7%">
        <input type="hidden" name="cart_item_id_checked[]" value="<?php echo $cart['id']; ?>">
        <input type="hidden" name="pids[]" value="<?php echo isset($cart['pid']) ? $cart['pid'] : null; ?>">
        <input type="hidden" name="cart_item_ids[]" value="<?php echo $cart['id']; ?>">
        <input type="hidden" name="product_price_<?php echo $cart['id']; ?>" id="product_price_<?php echo $cart['id']; ?>" data-val="<?php echo isset($product['price']) ? $product['price'] : null; ?>">
        <a href="<?php echo $product['url'];?>">
          <img src="<?php echo $product['small_img']; ?>" alt="<?php echo isset($product['name']) ? $product['name'] : null; ?>" class="db">
        </a>
           <?php
              $notMsizedata = true;
              $measureInfoCart = AttributeModel::get_user_measure_info($cart['measure_id']);
              if($measureInfoCart['m_status'] == 5){
              $notMsizedata = false;
              }
           ?>
        <?php
          if($cart['custom_type']==2){
            $product_url = url('product/custom', array('id' => $product['id'],'cid' => $cart['id']));
          }
        ?>
        <?php if($cart['custom_type']==2){?>
        <span class="check-options js-check-options"><?php echo L('_change_the_customization_options_');?></span>
        <div class="hide align-left pt2x pb2x custom-list js-custom-list">
            <p class="align-center">
            <a href="<?php echo $product_url;?>" class="btn"><?php echo L('edit');?></a>
          </p>
          <?php
            $size_type = $cart['size_type'];
            $attributeList = $cart['attributeList'];
            $product = $cart['product'];
          ?>
          <?php include THEMES_PATH . 'public/check_options.phtml'; ?>
          <?php if(!$notCustomEdit):?>
          <p class="align-center">
            <a href="<?php echo $product_url;?>" class="btn"><?php echo L('edit');?></a>
          </p>
          <?php endif;?>
        </div>
        <?php }?>
      </td>
      <td width="63%" class="pl1x pr1x vm">
        <a href="<?php echo $product['url'];?>" class="link-gray"><?php echo isset($product['name']) ? $product['name'] : null; ?></a>
        <br>
        <?php if($measureList &&$cart['custom_type']==2 && $notMsizedata && $product['model_id']!= 25): ?>
        <!-- 有身型数据 -->
        <div class="mt1x select-widget js-select-measurement">
          <i></i>
          <span><?php $measureInfoCart = AttributeModel::get_user_measure_info($cart['measure_id']);echo $measureInfoCart['measure_name']; ?></span>
          <select data-cashmere-sweater-tips="<?php echo L('_Cashmere_Sweaters_115_');?>" data-measurement-tips="<?php echo L('_edit_measure_id_').$cart['pid'].L("_edit_measure_pid_").$cart['measure_id'].L('_measure_edit_id_');?>">
            <?php
              if(isset($measureList) && $measureList):
                foreach ($measureList as $measure):
            ?>
            <option value="<?php echo $measure['id']; ?>"><?php echo isset($measure['measure_name']) ? $measure['measure_name'] : null; ?></option>
            <?php
                endforeach;
              endif;
            ?>
          </select>
        </div>
        <?php endif;?>

        <?php if($product['model_id'] == 25):?><!-- 鞋子尺码 -->
          <?php
            $attr_id = 162;
            $attr = $attributeList[$attr_id];
          ?>
        <p class="mt1x"><?php if(isset($attr['default']) && $attr['default']){echo $attr['name'].":".$attr['default'];}?></p>
        <?php endif;?>

          <?php
            $notMsizedata = true;
            if($cart['measure_id']):
          ?>
            <?php
              $measureInfoCart = AttributeModel::get_user_measure_info($cart['measure_id']);
              if($measureInfoCart['m_status'] == 5):
              $notMsizedata = false;
            ?>
              <?php foreach(unserialize($measureInfoCart['measure_data']) as $mskey=>$msval):?>
              <?php echo MeasureModel::msizedataShow($mskey);?>:<strong style="margin:0 10px 0 5px;"><?php echo $msval;?></strong>
              <?php endforeach;?>
          <?php endif;?>
        <?php endif;?>

        <?php if(!$measureList && $notMsizedata){?>
          <!-- 没有身型数据 -->
          <?php if($cart['custom_type']==2&&$product['model_id']!= 25){ ?>
            <?php if($cart['pro_type']==3):?>
            <?php else:?>
            <a href="<?php echo isset($login_url) ? $login_url.'/set/measure' : 'javascript:;';?>" class="hide add-measurement<?php echo isset($login_url) ? '' : ' js-add-measurement';?>"><?php echo L('_Measurement_Data_');?></a>
            <?php endif;?>
        <?php } ?>
        <?php }elseif($cart['custom_type']==2 && $notMsizedata){?>
        <?php if($cart['measure_id']&&!$cart['no_check']):?>
        <?php else:?>
        <p><a href="<?php echo isset($login_url) ? $login_url.'/set/measure' : 'javascript:;';?>" class="add-measurement<?php echo isset($login_url) ? '' : ' js-add-measurement';?>"><?php echo L('_Measurement_Data_');?></a></p>
        <?php endif;?>
        <?php }?>
      </td>
      <?php
        $advanced_price = $product['advanced_price'];
        $original_price = $product['original_price'];
      ?>
      <td width="30%" class="align-right">
        <p class="mb1x js-subtotal"><?php echo currency($product['price']*$cart['qty']); ?></p>
        <?php if($cart['pro_type']==0): ?>
        <div class="quantity-box">
          <?php if($cart['pro_type']==0): ?><i class="decrease js-decrease">-</i><?php endif; ?>
          <input type="text" value="<?php echo isset($cart['qty']) ? $cart['qty'] : 1; ?>" class="quantity js-quantity" disabled>
          <?php if($cart['pro_type']==0): ?><i class="increase js-increase">+</i><?php endif; ?>
        </div>
        <?php endif; ?>
        <span title="<?php echo L('delete');?>" data-cart-id="<?php echo $cart['id'];?>" data-btn1="<?php echo L('determine'); ?>" data-btn2="<?php echo L('cancel'); ?>" data-msg="<?php echo L('del_goods_confirm'); ?>" class="delete js-delete">×</span>
      </td>
    </tr>

    <?php
      if($cart['add_pants']):
      $add_pants = $cart['add_pants'];
    ?>
    <!-- pants, start -->
    <tr id="additional-pants-<?php echo $cart['id'];?>" data-goods-id="<?php echo $cart['product']['id'];?>" data-cart-id="<?php echo $cart['id']; ?>" data-unit-price="<?php echo $add_pants['price'] ;?>" class="add_pants_tr">
      <td width="37%" colspan="2" class="js-add-pants">
        <label>
          <input type="checkbox"<?php if($cart['pants_qty'] > 0):?> checked<?php endif; ?> value="<?php echo $cart['id'];?>" autocomplete="off" />
          <span class="vm"><?php echo $add_pants['name']; ?> (<?php echo currency($add_pants['price']); ?>)</span>
        </label>
      </td>
      <td width="20%" class="align-right">
        <p class="<?php if($cart['pants_qty'] < 1):?> hide<?php endif;?>mb1x pants-price js-subtotal"><?php echo currency($add_pants['price']*$cart['pants_qty']); ?></p>
        <div class="quantity-box<?php if($cart['pants_qty'] < 1):?> hide<?php endif;?> js-quantity-box">
          <?php if($cart['pro_type']==0): ?><i class="decrease js-pants-decrease">-</i><?php endif; ?>
          <input type="text" value="<?php echo isset($cart['pants_qty']) ? $cart['pants_qty'] : 1; ?>" class="quantity js-pants-quantity" disabled>
          <?php if($cart['pro_type']==0): ?><i class="increase js-pants-increase">+</i><?php endif; ?>
        </div>
      </td>
    </tr>
    <!-- pants, end -->
    <?php endif;?>

    <?php endif;?>
    <?php
      endforeach;
    ?>
  </table>
  <?php if( (isset($measureList) && $measureList) || ($custom_count == 0) ){?>
  <?php }else{?>
  <!--ADD MEASUREMENT & CHECKOUT-->
  <div class="clearfix mt2x measure-methods">
    <p class="clearfix mb2x align-center font-md black">请选择量体方式</p>
    <div class="mb2x">
      <a href="/schedule/<?php echo base64_encode(serialize($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']))?>">
        <img src="/statics/front/images/cart/measurement1.jpg" class="width-full">
        <span>预约量体</span>
      </a>
      <div>
        <p>我们为杭州地区的用户提供上门量体服务，收取99元的量体费用，如果您的订单金额超过2999元，免收99元量体费用。</p>
        <p class="mt1x mb1x">您也可以选择到店量体，免收量体费。</p>
        <p>填写您的联系方式和希望量体的地点，并继续完成结算。收到订单后，我们的量体师将在24小时内和您联得联系并确认具体时间。如有任何疑问，可以在预约时留言。</p>
      </div>
    </div>
    <div class="mb2x">
      <a href="<?php echo isset($login_url) ? $login_url.'/set/measure' : 'javascript:;';?>" class="<?php echo isset($login_url) ? ' js-to-checkout' : ' js-add-measurement';?>">
        <img src="/statics/front/images/cart/measurement2.jpg" class="width-full">
        <span>在线量体</span>
      </a>
      <div>
        <p>您只需要一把卷尺和一个朋友，跟着我们的教学视频，花10分钟，完成在线自助量体。</p>
        <p class="mt1x mb1x">您也可以到就近的裁缝店或请专业的量体师为您量体，并填写到网上。</p>
        <p>您所填写的数据，都会由专业的版师进行审核，该审核方式通过千万用户的验证，请放心使用！</p>
      </div>
    </div>
  </div>
  <?php }?>
  <div class="mt2x align-right money-amount">
    <p class="clearfix mb1x text hide js-coupon-discount">
      <span class="pull-left"><?php echo L('order_discount_you_save'); ?>:</span>
      <strong class="pull-right js-discount-money">0.00</strong>
    </p>
    <p class="clearfix mb1x text">
      <span class="pull-left"><?php echo L('_SUB_TOTAL_')?>:</span>
      <strong class="pull-right js-total-amount"><?php echo isset($cartInfo['total_amount']) ? currency($cartInfo['total_amount']) : 0;?></strong>
    </p>
    <p class="mb1x">
      <?php if( (isset($measureList) && $measureList) || ($custom_count == 0) ){?>
      <!--CHECKOUT-->
       <a href="<?php echo $upCartCount==0|| $i_chest>0||$data_cart>0? 'javascript:;' : url('cart/checkout');?>" data-href="<?php echo url('cart/checkout')?>" class="<?php if($upCartCount==0||$i_chest>0||$data_cart>0):?>disabled <?php endif;?>width-full btn js-to-checkout"><?php echo L('checkout')?></a>
      <?php }?>
    </p>
  </div>
  <ul class="clearfix auto mt1x align-center shopping-clause">
    <li>
      <span><?php echo L('receiver_by_november');?></span>
      <p><img src="/statics/front/images/icons/lightning.png" alt="<?php echo L('receiver_by_november');?>"/></p>
    </li>
    <li>
      <span><?php echo L('free_shipping');?></span>
      <p><img src="/statics/front/images/icons/shipment.png" alt="<?php echo L('free_shipping');?>"/></p>
    </li>
    <li>
      <span><?php echo L('fit_promise');?></span>
      <p><img src="/statics/front/images/icons/fit.png" alt="<?php echo L('fit_promise');?>"/></p>
    </li>
  </ul>
  <?php else:?>
  <div class="mt2x mb2x align-center shopping-empty">
    <p class="mb1x text"><?php echo L('nothing_in_cart'); ?></p>
    <a href="/" class="btn"><?php echo L('_continue_shopping_'); ?></a>
  </div>
  <?php endif;?>
</div>
<div class="main-width heading">
  <strong><?php echo L('_You_May_Also_Like_');?></strong>
</div>
<div class="ovh rel main-width align-center carousel-box">
  <div class="ovh carousel js-carousel" data-mobile="true">
    <ul class="rel">
      <?php
        if(isset($productList) && $productList):
          foreach ($productList as $key => $product):
      ?>
      <li>
        <a href="<?php echo $product['url'];?>">
          <img src="<?php echo $product['goods_img']?>">
          <?php if(!empty($product['ml_img'])){ ?>
          <img src="<?php echo $product['ml_img']?>" class="hide">
          <?php } ?>
        </a>
        <p>
          <a href="<?php echo $product['url'];?>"><?php echo $product['name'];?></a>
        </p>
        <p>
          <?php
            if($product['attribute_type']==2){
              if($product['product_type']){
                echo currency($product['sell_price']);
              }else{
                echo currency($product['advanced_price']);
              }
            }elseif($product['attribute_type']==1){
              echo currency($product['custom_price']);
            }
          ?>
        </p>
      </li>
      <?php
          endforeach;
        endif;
      ?>
    </ul>
  </div>
  <span class="fa fa-2x fa-chevron-left carousel-control-prev js-carousel-control-prev"></span>
  <span class="fa fa-2x fa-chevron-right carousel-control-next js-carousel-control-next"></span>
</div>
<?php include THEMES_PATH.'public/measure_guide.phtml';?>
<div class="mask js-mask"></div>
<!-- build:js /statics/front/pkg/js/carousel.js -->
<script src="/statics/front/js/plugins/carousel/jquery.jcarousel.min.js"></script>
<script src="/statics/front/js/plugins/carousel/jquery.jcarousel-swipe.min.js"></script>
<script src="/statics/front/js/scripts/carousel-list.js"></script>
<!-- endbuild -->

<script src="/statics/front/js/plugins/jquery.popupBox.js"></script>
<script src="/statics/front/js/scripts/cart.js"></script>
<script src="/statics/front/js/scripts/cart/common.js"></script>
<script src="/statics/front/js/scripts/cart/change-quantity.js"></script>
<script src="/statics/front/js/scripts/cart/additional-pants.js"></script>
<script src="/statics/front/js/scripts/cart/delete-goods.js"></script>
<script src="/statics/front/js/scripts/cart/select-measurement.js"></script>
<?php include THEMES_PATH . 'public/footer2.phtml'; ?>
<?php include THEMES_PATH . 'public/after_body.phtml'; ?>